package com.aipsi.cws.auto.interceptor;

import com.appium.manager.element.anno.PageElement;
import com.appium.manager.element.anno.interceptor.PageInterceptor;
import com.appium.manager.template.AnnoAppiumHybridTemplate;
import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;


/**
 * <p>
 *     通用的登录操作
 * </p>
 * @author 大忽悠
 * @create 2022/7/8 16:45
 */
@Slf4j
public class LoginInterceptor implements PageInterceptor {

     @FindBy(css = "body > app-root > ion-app > ion-router-outlet > app-login > ion-content > div.ion-margin-top.ion-text-center.ion-margin-horizontal > ion-checkbox")
     private WebElement agreeCheckBox;

     @FindBy(xpath = "/html/body/app-root/ion-app/ion-router-outlet/app-login/ion-content/div[2]/ion-router-link")
     private WebElement quickStart;

    public void doInvoke(PageElement pageElement, AnnoAppiumHybridTemplate appiumHybridTemplate) {
        log.info("点击同意协议");
        agreeCheckBox.click();
        log.info("点击快速体验");
        quickStart.click();
    }
}
